package com.minimalist.common.entity.lindi.vo.tradeapplicationcontract;

import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.minimalist.common.entity.basic.vo.file.FileVO;
import com.minimalist.common.utils.Add;
import com.minimalist.common.utils.Update;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Objects;

/**
 * 林地指标交易平台_交易申请合同VO
 *
 * @author 11987
 */
@Schema(name = "林地指标交易平台_交易申请合同实体")
public class LindiTradeApplicationContractVO implements Serializable{
    @Serial
    private static final long serialVersionUID = 1L;

    // ========== 基本信息 ==========

    @NotNull(message = "指标交易申请合同ID不能为空", groups = {Update.class})
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "tradeApplicationContractId", description = "指标交易申请合同ID", type = "string")
    private Long tradeApplicationContractId;

    @NotNull(message = "交易申请ID不能为空", groups = {Add.class, Update.class})
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "tradeApplicationId", description = "交易申请ID", type = "string")
    private Long tradeApplicationId;

    @Schema(name = "contractNumber", description = "合同编号", type = "string")
    private String contractNumber;

    @NotBlank(message = "合同名称不能为空", groups = {Add.class, Update.class})
    @Schema(name = "contractName", description = "合同名称", type = "string")
    private String contractName;

    @Schema(name = "contractAmount", description = "合同金额(万元)", type = "string")
    private String contractAmount;

    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @Schema(name = "effectiveDate", description = "签订日期", type = "string")
    private LocalDateTime effectiveDate;

    @Schema(name = "contractType", description = "合同类型", type = "string")
    private String contractType;

    // ========== 文件信息 ==========

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "contractFileId", description = "合同文件ID", type = "string")
    private Long contractFileId;

    @Schema(name = "contractFile", description = "合同文件")
    private FileVO contractFile;

    // ========== 审计字段 ==========

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "createId", description = "创建人ID", type = "string")
    private Long createId;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(name = "updateId", description = "更新人ID", type = "string")
    private Long updateId;

    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @Schema(name = "createTime", description = "创建时间", type = "string")
    private LocalDateTime createTime;

    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @Schema(name = "updateTime", description = "更新时间", type = "string")
    private LocalDateTime updateTime;

    public Long getTradeApplicationContractId(){
        return tradeApplicationContractId;
    }

    public void setTradeApplicationContractId(Long tradeApplicationContractId){
        this.tradeApplicationContractId = tradeApplicationContractId;
    }

    public Long getTradeApplicationId(){
        return tradeApplicationId;
    }

    public void setTradeApplicationId(Long tradeApplicationId){
        this.tradeApplicationId = tradeApplicationId;
    }

    public String getContractNumber(){
        return contractNumber;
    }

    public void setContractNumber(String contractNumber){
        this.contractNumber = contractNumber;
    }

    public String getContractName(){
        return contractName;
    }

    public void setContractName(String contractName){
        this.contractName = contractName;
    }

    public String getContractAmount(){
        return contractAmount;
    }

    public void setContractAmount(String contractAmount){
        this.contractAmount = contractAmount;
    }

    public LocalDateTime getEffectiveDate(){
        return effectiveDate;
    }

    public void setEffectiveDate(LocalDateTime effectiveDate){
        this.effectiveDate = effectiveDate;
    }

    public String getContractType(){
        return contractType;
    }

    public void setContractType(String contractType){
        this.contractType = contractType;
    }

    public Long getContractFileId(){
        return contractFileId;
    }

    public void setContractFileId(Long contractFileId){
        this.contractFileId = contractFileId;
    }

    public FileVO getContractFile(){
        return contractFile;
    }

    public void setContractFile(FileVO contractFile){
        this.contractFile = contractFile;
    }

    public Long getCreateId(){
        return createId;
    }

    public void setCreateId(Long createId){
        this.createId = createId;
    }

    public Long getUpdateId(){
        return updateId;
    }

    public void setUpdateId(Long updateId){
        this.updateId = updateId;
    }

    public LocalDateTime getCreateTime(){
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime){
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime(){
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime){
        this.updateTime = updateTime;
    }

    @Override
    public boolean equals(Object o){
        if (o == null || getClass() != o.getClass()){
            return false;
        }
        LindiTradeApplicationContractVO that = (LindiTradeApplicationContractVO) o;
        return Objects.equals(tradeApplicationContractId, that.tradeApplicationContractId)
                && Objects.equals(tradeApplicationId, that.tradeApplicationId)
                && Objects.equals(contractNumber, that.contractNumber)
                && Objects.equals(contractName, that.contractName)
                && Objects.equals(contractAmount, that.contractAmount)
                && Objects.equals(effectiveDate, that.effectiveDate)
                && Objects.equals(contractType, that.contractType)
                && Objects.equals(contractFileId, that.contractFileId)
                && Objects.equals(contractFile, that.contractFile)
                && Objects.equals(createId, that.createId)
                && Objects.equals(updateId, that.updateId)
                && Objects.equals(createTime, that.createTime)
                && Objects.equals(updateTime, that.updateTime);
    }

    @Override
    public int hashCode(){
        return Objects.hash(tradeApplicationContractId, tradeApplicationId, contractNumber, contractName, contractAmount, effectiveDate, contractType, contractFileId, contractFile, createId, updateId, createTime, updateTime);
    }
}
